package com.power.sifa.approve.model;


import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
*  自定义过程材料实体类
*/

@Entity
@ApiModel(value="自定义过程材料")
@Data
@Table(name="Aprv_materials_customer",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Aprv_materials_customer.Aprv_materials_customerPK.class) 用于复合组件
public class Aprv_materials_customer extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "nanoid")
    private String id;

    @ApiModelProperty(value = "引用主表id")
    private String applyid;

    @ApiModelProperty(value = "顺序")
    private Integer sortnum;

    @ApiModelProperty(value = "材料类型名称")
    private String name;

    @ApiModelProperty(value = "材料描述")
    private String describe;

    @ApiModelProperty(value = "过程类型")
    private Integer proctype;

    /**
     *  过程类型文本
     */
    @Transient
    @FieldEnumText(eum="Tp_proctype", valuefield="proctype")
    private String proctype_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("applyid", this.getApplyid());
        map.put("sortnum", this.getSortnum());
        map.put("name", this.getName());
        map.put("describe", this.getDescribe());
        map.put("proctype_text", this.proctype_text);
        map.put("proctype", this.getProctype());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Aprv_materials_customerPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Aprv_materials_customerPK pk = (Aprv_materials_customerPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}